package com.caifeng.myapplication.listview;

import android.os.Bundle;
import android.widget.ListView;

import androidx.appcompat.app.AppCompatActivity;

import com.caifeng.myapplication.R;

import java.util.ArrayList;
import java.util.List;

public class ListDemo extends AppCompatActivity {



    private List<ListData> mListData;
    private ListView listView;
    MyAdapter adapter;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.list_view);

        listView=findViewById(R.id.list_view);
        adapter=new MyAdapter(this,getmListData());
        listView.setAdapter(adapter);


    }
    public List<ListData> getmListData() {
        mListData=new ArrayList<>();
        ListData listData=new ListData();
        listData.setT("123");
        listData.setImag(R.mipmap.ic_launcher);

        mListData.add(listData);


        return mListData;
    }

}
